package event;

import model.code.Function;
import model.symbol.LocalVariable;

/**
 * This is for events in which a {@link model.code.Function} has a parameter removed.
 *
 * Authors: Neil Dickson
 */
public class ParameterRemovedEvent extends SymbolChangeEvent {
	private LocalVariable	parameter;
	private	int				index;

	public ParameterRemovedEvent(Function function,LocalVariable parameter,int index) {
		super(function);
		this.parameter = parameter;
		this.index = index;
	}
	public Undoable undo() {
		((Function)symbol).addParameter(parameter,index);
		return new ParameterAddedEvent((Function)symbol,parameter,index);
	}

	public String getDescription() {
		return "Removed "+symbol.getName()+" parameter "+index;
	}
}
